

const path = require('path');
const staticImg = path.join(__dirname, 'static');

function SensorbitUnoBlocks(Blockly) {
    var color_do = "#FF0000";



    //舵机
    Blockly.Blocks.microbit_servo = {
        init:function(){
            this.setColour(color_do);
            this.appendDummyInput("")
            .appendField(new Blockly.FieldImage(staticImg+"/Servo.svg", 84, 42))
            .appendField(Blockly.Msg.MICROBIT_SERVO)
            .appendField(new Blockly.FieldDropdown([
                ['P0', "pin0"],
                ['P1', "pin1"],
                ['P2', "pin2"],
                ['P3', "pin3"]
            ]),"servoPort")
                this.appendValueInput("servoAngle", Number)
                .appendField(Blockly.Msg.MICROBIT_SERVOANGLE)
            this.setPreviousStatement(true,null);
            this.setNextStatement(true,null);
            this.setTooltip('');
        }
    };

    return Blockly;
}

module.exports = SensorbitUnoBlocks;

